package com.bjpowernode.service.impl;

import com.bjpowernode.dao.AccountDao;
import com.bjpowernode.service.AccountService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

@Service
public class AccountServiceImpl implements AccountService {
    @Autowired
    private AccountDao accountDao;

    // 事务处理必须使用同一个连接对象
    public void transfer(String from, String to, int money) {
        accountDao.updateBalance(from, -money);
        System.out.println(1/0);
        accountDao.updateBalance(to, money);
    }
}
